CC := gcc

CFLAGS := -Wall -fPIC -g -I./

LDFLAGS := -L./ -shared -g

TARGET_LIB := libmem_watcher.so
TARGET_BIN := main.bin

all: $(TARGET_LIB) $(TARGET_BIN)

$(TARGET_LIB): mem_watcher.o
	$(CC) $(LDFLAGS) -o $@ $^

$(TARGET_BIN): main.o $(TARGET_LIB)
	$(CC) -o $@ main.o -lpthread -ldl

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f *.o $(TARGET_LIB) $(TARGET_BIN)

.PHONY: all clean
